<?php
/**
 * Created by PhpStorm.
 * User: changyifan
 * Date: 2018/3/9
 * Time: 下午4:38
 */

namespace Think\Controller;
use Think\Controller;
use Think\Event\BaseEvent;
class BaseController extends Controller{
    //学院
    protected $school;
    protected $school_dao;
    //系部
    protected $department;
    protected $department_dao;
    //专业
    protected $profession;
    protected $profession_dao;
    //班级
    protected $naturalclass;
    protected $naturalclass_dao;
    //教师
    protected $teacher;
    protected $teacher_dao;
    //学生
    protected $student;
    protected $student_dao;
    //视频
    protected $video;
    protected $video_dao;
    //课程
    protected $course;
    //课程类型
    protected $tctype;
    //实验语言
    protected $language;
    //知识点
    protected $point;

    //教学方案
    protected $teachingmethod;
    protected $teachingmethod_dao;
    //章
    protected $chapter;
    protected $chapter_dao;
    //节
    protected $section;
    protected $section_dao;



    //授课班级
    protected $teachingclass;
    protected $teachingclass_dao;


    //测试规格
    protected $textrule;
    //作业
    protected $homework;

    //授课班学生
    protected $stu_tc;
    protected $stu_tc_dao;
    //公告
    protected $annoucement;
    //练习转换规则
    protected $practice_rule;
    //论坛转换规则
    protected $bbs_rule;
    //教师权限
    protected $teachercourse;
    protected $teachercourse_dao;
    //题型
    protected $exetype;
    //大类题型
    protected $exekind;
    //公共事件处理器
    protected $event;
    //难度
    protected $difficulty;
    //习题
    protected $exercise;
    //练习题
    protected $practice;
    function _initialize(){


        $user = session(C('USER_AUTH_KEY'));

        if (!isset($user)) {
            //跳转到认证网关
            redirect(U(C('USER_AUTH_GATEWAY')));
        }
        $this->event = new BaseEvent();
        $this->initAPP();
    }
    public function initAPP(){
        $this->school = D('School','Model');
        $this->school_dao = D('School','Dao');
        $this->department = D('Department','Model');
        $this->department_dao = D('Department','Dao');
        $this->profession = D('Profession','Model');
        $this->profession_dao = D('Profession','Dao');
        $this->naturalclass = D('Naturalclass','Model');
        $this->naturalclass_dao = D('Naturalclass','Dao');
        $this->teacher = D('Teacher','Model');
        $this->teacher_dao = D('Teacher','Dao');
        $this->student = D('Student','Model');
        $this->student_dao = D('Student','Dao');

        $this->course = D('Course','Model');
        $this->tctype = D('Tctype','Model');
        $this->language = D('Language','Model');
        $this->point = D('Point','Model');

        $this->teachingmethod = D('Teachingmethod','Model');
        $this->teachingmethod_dao = D('Teachingmethod','Dao');
        $this->chapter = D('Chapter','Model');
        $this->chapter_dao = D('Chapter','Dao');
        $this->section = D('Section','Model');
        $this->section_dao = D('Section','Dao');
        $this->textrule = D('Testrule','Model');
        $this->homework = D('Homework','Model');
        $this->teachingclass = D('Teachingclass','Model');
        $this->teachingclass_dao = D('Teachingclass','Dao');
        $this->stu_tc = D('StuTc','Model');
        $this->stu_tc_dao = D('StuTc','Dao');

        $this->annoucement = D('Annoucement','Model');
        $this->practice_rule = D('PracticeRule','Model');
        $this->bbs_rule = D('BbsRule','Model');
        $this->teachercourse = D('teachercourse','Model');
        $this->teachercourse_dao = D('teachercourse','Dao');


        $this->video = D('Video','Model');
        $this->video_dao = D('Video','Dao');
        //题型
        $this->exetype = D('Exetype','Model');
        //难度
        $this->difficulty = D('Difficulty','Model');
        //大类题型
        $this->exekind = D('exekind','Model');
        //习题
        $this->exercise = D('Exercise','Model');
        //练习题
        $this->practice = D('Practice','Model');
    }

}